package ru.unlocker.reports.domain;

import java.io.Serializable;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.EqualsAndHashCode.Include;
import lombok.NoArgsConstructor;
import lombok.NonNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class RawReportEvent implements Serializable {

  @NonNull
  private Instant createdAt;
  @NonNull
  private ReportEventKind reportEvent;
  @NonNull
  @Include
  private UUID reportId;
  @NonNull
  private UUID groupId;
  private String reportCode;
  private LocalDate workday;
  private Duration duration;
  private String errorMessage;

  public long getTimestamp() {
    return createdAt.toEpochMilli();
  }
}
